/*
 *接口编写处...
*如果接口需要做Action的权限验证，请在Action上使用属性
*如: [ApiActionPermission("ak_wgjy_sgd_peizhi",Enums.ActionPermissionOptions.Search)]
 */
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.AspNetCore.Http;
using ATkg.BizAppProject.DomainModels;
using ATkg.BizAppProject.IServices;
using Microsoft.AspNetCore.Authorization;
using DGZImp.Core.DBManage;
using Newtonsoft.Json.Linq;

namespace ATkg.BizAppProject.Controllers
{
    public partial class ak_wgjy_sgd_peizhiController
    {
        private readonly Iak_wgjy_sgd_peizhiService _service;//访问业务代码
        private readonly IHttpContextAccessor _httpContextAccessor;

        [ActivatorUtilitiesConstructor]
        public ak_wgjy_sgd_peizhiController(
            Iak_wgjy_sgd_peizhiService service,
            IHttpContextAccessor httpContextAccessor
        )
        : base(service)
        {
            _service = service;
            _httpContextAccessor = httpContextAccessor;
        }

        [HttpGet("search_gx_detail")]
        [AllowAnonymous]
        //[HttpBody]
        public async Task<JsonResult> search_gx_detail()
        //public async Task<JsonResult> SyncProductionTask_wgjy([FromBody] PageDataOptions order_no_)

        {
            Console.WriteLine("get方法调用");
            var rows = await Service.search_gx_detail_all();
            //var r = 0;

            //var r = 0;
            return JsonNormal(rows);
        }

        [HttpGet("insert_info_gx")]
        [AllowAnonymous]
        //[HttpBody]
        public async Task<string> insert_info_gx(string option, string mes_data)

        {
            JArray mes_data_final = JArray.Parse(mes_data);
            Console.WriteLine(mes_data_final);
            //Console.WriteLine(mes_data_final["defect_plating_disability_final_qty"]);
            //Console.WriteLine(mes_data_final["inspection_time"]);
            var rows = await Service.insert_gx_info(option, mes_data_final);
            //var r = 0;

            //var r = 0;
            return "成功";
        }

        [HttpGet("search_info_db")]
        [AllowAnonymous]
        //[HttpBody]
        public async Task<JsonResult> search_info_db()
        //public async Task<JsonResult> SyncProductionTask_wgjy([FromBody] PageDataOptions order_no_)

        {
            Console.WriteLine("get方法调用");
            var rows = await Service.search_info_db_all();
            //var r = 0;

            //var r = 0;
            return JsonNormal(rows);
        }
    }
}
